// Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved.

// 弹性伸缩策略结构定义
package model

type CreateScalingPolicyReq struct {
	TargetConfiguration *TargetConfiguration `json:"target_based_configuration,omitempty" validate:"required_if=Type TARGET_BASED"`
	Name                *string              `json:"name" validate:"required,min=1,max=1024"`
	Type                *string              `json:"policy_type" validate:"required,oneof=TARGET_BASED"`
}

type UpdateScalingPolicyReq struct {
	TargetConfiguration *TargetConfiguration `json:"target_based_configuration,omitempty" validate:"omitempty"`
	Name                *string              `json:"name,omitempty" validate:"omitempty,min=1,max=1024"`
}

type TargetConfiguration struct {
	MetricName     *string `json:"metric_name" validate:"required,oneof=PERCENT_AVAILABLE_SERVER_SESSIONS"`
	MinTargetValue *int32  `json:"min_target_value" validate:"required,gte=1,ltefield=MaxTargetValue"`
	MaxTargetValue *int32  `json:"max_target_value" validate:"required,gte=1,lte=100"`
}

type CreateScalingPolicyResp struct {
	ScalingPolicyId string `json:"scaling_policy_id"`
}

type ListFleetOfPolicyResp struct {
	Count   int      `json:"count"`
	FleetId []string `json:"fleet_id"`
}

type ScalingPolicy struct {
	Name         string `json:"name"`
	PolicyId     string `json:"policy_id"`
	PolicyType   string `json:"policy_type"`
	PolicyConfig string `json:"policy_config"`
}

type ListPolicyOfFleetResp struct {
	Count      int             `json:"count"`
	PolicyList []ScalingPolicy `json:"policy_list"`
}

type ListRelationResp struct {
	Count    int        `json:"count"`
	Relation []Relation `json:"relation"`
}

type Relation struct {
	ScalingPolicyId string `json:"scaling_policy_id"`
	ScalingGroupId  string `json:"scaling_group_id"`
	FleetId         string `json:"fleet_id"`
}
